package dom;

import bean.user;
import cont.contr;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class redom extends user {
    public static void registered(String userid,String name, String password , String number){
        try {
            Connection conn = contr.getConn();
            String sql = "insert into user(userid,name,password,number) values(?,?,?,?)";
            PreparedStatement pstmt = conn.prepareStatement(sql);
            pstmt.setString(1, userid);
            pstmt.setString(2, name);
            pstmt.setString(3, password);
            pstmt.setString(4, number);
            pstmt.execute();
            System.out.println("插入已完成");
            pstmt.close();
            System.out.println("关闭查询");
            conn.close();
            System.out.println("关闭数据库连接");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
